(function($) {
	var $dropdown = $('#dropdown');
	var $closelogin = $('#close-login');
	var $login = $('#login');

	var $register = $('#register');
	var $signup = $('#signup');
	var $begin = $('#begin');

	$dropdown.on('click',function($){
		$login.slideToggle();
	});	

	$closelogin.on('click',function($){
		$login.slideToggle();
	});

	$signup.on('click',function($){
		$register.slideToggle();
	});
	$begin.on('click',function($){
		$register.slideToggle();
	});
	/* Get latest tweets */
	var $twitterDiv = $('#twitter');
	$.getJSON("https://api.twitter.com/1/statuses/user_timeline/PlayCnC.json?count=1&include_rts=1&callback=?", function(data) {
		$twitterDiv.html(data[0].text);
	});

	

	/* Get facebook like count */
	var $facebookcountDiv = $(".facebookcount")
	$.getJSON('http://graph.facebook.com/playcnc', function(data){
		var likes = data["likes"];
		if(likes == null){
			$facebookcountDiv.append('0');
		}else{
			$facebookcountDiv.append(likes+' likes');
		}
		
	});

	/* Get facebook share count */
	var $facebookDiv = $(".facebookshare")
	$.getJSON('http://graph.facebook.com/?id=http://www.playcnc.net', function(data){
		var shares = data["shares"];
		if(shares == null){
			$facebookDiv.append('0');
		}else{
			$facebookDiv.append(shares + ' shares');
		}
		
	});


	$(window).scroll(function() {
		var $top = $('#top');
		if ($(this).scrollTop() == 0) {
			$top.removeClass('top-shadow');
		}
		else {
			$top.addClass('top-shadow');
		}
	});

})(jQuery);